<template>
  <ForOneHeader :enableBack="true" />
  <view class="align-center">
    <view style="padding: 20px; width: 100%">
      <!-- 以下形式在微信小程序会无效，APP和H5有效  -->
      <button type="primary" @tap="handleLogin">一键登陆</button>
    </view>
  </view>
</template>

<script setup>
import { login } from '@/utils/auth'
import * as _ from 'lodash'

const getUserProfile = (e) => {
  uni.getUserProfile({
    desc: '用于完善会员资料',
    success: (res) => {
      console.log(res)
    }
  })
}
const handleLogin = _.throttle(async () => {
  try {
    uni.showLoading({
      title: '登陆中',
      mask:true
    })
    await login()
    uni.navigateBack()
  } finally {
    uni.hideLoading()
  }
},800)
</script>

<style scoped>
.align-center {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100vw;
}
</style>
